import { App } from 'vue'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
import { message } from 'ant-design-vue'

const install_message = (app: App) => {
  // eslint-disable-next-line no-param-reassign
  app.config.globalProperties.$message = message
}

// 注册全局dayjs方法
const install_dayjs = (app: App) => {
  dayjs.locale('zh-cn')
  // eslint-disable-next-line no-param-reassign
  app.config.globalProperties.$dayjs = dayjs
}

// 注册全局方法
export function registerGlobal(app: App) {
  app.use(install_dayjs)
  app.use(install_message)
}
